home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-09-13 | 6.5 KB | 346 lines | [TEXT/MSWD] |
- ( ROUTINE: Fix for RR10
- (
- ( PURPOSE: Attempts to automatically convert Red Ryder procedures created
- ( for 9.X to the new 10.0 syntax. Specifically does the
- ( following:
- (
- ( 1. Saves original file with .OLD extension to file name
- ( 2. Converts all comments to labels (simplistic but effective)
- ( 3. ESC becomes ALT
- ( 4. DEL becomes DELKEY
- ( 5. MENUDOES reformatted but left incomplete (sorry)
- ( 6. MENU OFF becomes MENUOFF
- ( 7. Converts all variables to new style (e.g. ~9 becomes Z$)
- ( 8. Compiles result unless problem #5 above encounterd
- (
- ( PROBLEMS: The following are known limitations of this procedure:
- (
- ( 1. ESC, DEL, MENUDOES, and MENU OFF are not converted if not
- ( first command in line (i.e. column 1). Otherwise I might
- ( convert lines such as: COPYINTO A$,ALTERNATIVE
- ( 2. Converting comments into labels might overflow label limits.
- ( Since most of my procedures are small, this is not expected.
- (
- ( WARNNGS: Do not run on an already converted file.
- (
- ( LICENSE: This procedure is not in the public domain, but may be freely
- ( used for non-commercial purposes by all paid & registered users
- ( of Freesoft's Red Ryder 10.0 terminal emulation program. It
- ( may not be sold nor used as incentive to buy any other product.
- ( This procedure is supplied for use AS IS, and there are no
- ( guarantees of correctness or usability for any particular
- ( purpose. USE AT YOUR OWN RISK.
- (
- ( AUTHOR: David C. Black, 311 Blackberry Drive, Austin, Tx 78745-6546
- ( COPYRIGHT ©1987 by David Black, all rights reserved.
- (
- ( NOTE: If you should find ways to improve this procedure, I would
- ( appreciate hearing from you about the modifications. If you
- ( do modify this procedure, please make appropriate additions to
- ( the history below, and indicate your name & address before
- ( supplying copies of your 'new & improved' version to others. I
- ( can respond to my own code, but I cannot respond support
- ( others.
- (
- ( MODIFIED WHO VER REASON
- ( -------- --- --- ------
- ( 09/06/87 DCB 1.0 Original
- (**********************************************************************
-
- ( *** Initializations ***
- ERASE X$
- COPYINTO Y$,Procedure to fix Red Ryder PROCs for version 10.0
- COPYINTO Z$,COPYRIGHT 1987 by David Black, all rights reserved.
- QUERY2
- COPYINTO @0,Updating Red Ryder PROCs for version 10.0
- ERASE @1
- ERASE @2
- @ ON
- WATCH ON
- COPYINTO D$,$
- COPYINTO P$,%
- LET EQUAL C%,0
- LET EQUAL M%,0
-
- ( *** Open up files ***
- COPYINTO @2,Select file to update:
- SHOW@
- BELL
- GETSELECT TEXT
- GETFILE O$
- ERASE @2
- SHOW@
- IF NO JUMPTO ABORT
- WATCH ON
- COPYINTO I$,O$
- CONCAT I$,.OLD
- RENAME O$,I$
- USEROPENI 1,I$
- USEROPENO 2,O$
- COPYINTO Z$,Renamed original to '
- CONCAT Z$,I$
- CONCAT Z$,'...
- QUERY5
-
- ( *** Loop until end-of-file encountered ***
- :LOOP
- USERREAD 1,L$
- IF ERROR JUMPTO EXITLOOP
- GOSUB SANITY
-
- ( *** Skip empty lines
- EMPTY L$
- IF YES JUMPTO WRITE_RESULT
-
- ( *** Convert comments to labels ***
- INSTR L%,L$,1,(
- TEST L% = 1
- IF NO JUMPTO END_COMMENT
- COPYINTO T$,:
- CONCAT T$,L$
- COPYINTO L$,T$
- JUMPTO WRITE_RESULT
- :END_COMMENT
-
- ( *** Convert ESC to ALT ***
- INSTR L%,L$,1,ESC
- TEST L% = 1
- IF NO JUMPTO END_ALT
- REPLACE$ L$,3,1,ALT
- :END_ALT
-
- ( *** Convert DEL to DELKEY ***
- INSTR L%,L$,1,DEL
- TEST L% = 1
- IF NO JUMPTO END_DELKEY
- REPLACE$ L$,3,1,KEY
- COPYINTO T$,DEL
- CONCAT T$,L$
- COPYINTO L$,T$
- :END_DELKEY
-
- ( *** Reformat MENUDOES commands ***
- INSTR L%,L$,1,MENUDOES
- TEST L% = 1
- IF NO JUMPTO END_MENUDOES
- ADD M%,1
- COPYINTO T$,L$
- COPYINTO L$,MENUDOES
- MID$ U$,9,2,T$
- CONCAT L$,T$
- CONCAT L$,,__Replace_
- MID$ U$,12,2,T$
- CONCAT L$,T$
- CONCAT L$,_with_action_from_macro_set__
- :END_MENUDOES
-
- ( *** Convert MENU OFF to MENUOFF ***
- INSTR L%,L$,1,MENU OFF
- TEST L% = 1
- IF NO JUMPTO END_MENUOFF
- COPYINTO L$,MENUOFF
- JUMPTO WRITE_RESULT
- :END_MENUOFF
-
- ( *** Convert variables to new equivalents ***
- INSTR L%,L$,1,~9
- TEST L% = 0
- IF YES JUMPTO END_~9
- REPLACE$ L$,1,L%,Z
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~9
-
- INSTR L%,L$,1,~8
- TEST L% = 0
- IF YES JUMPTO END_~8
- REPLACE$ L$,1,L%,Y
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~8
-
- INSTR L%,L$,1,~7
- TEST L% = 0
- IF YES JUMPTO END_~7
- REPLACE$ L$,1,L%,X
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~7
-
- INSTR L%,L$,1,~6
- TEST L% = 0
- IF YES JUMPTO END_~6
- REPLACE$ L$,1,L%,W
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~6
-
- INSTR L%,L$,1,~5
- TEST L% = 0
- IF YES JUMPTO END_~5
- REPLACE$ L$,1,L%,V
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~5
-
- INSTR L%,L$,1,~4
- TEST L% = 0
- IF YES JUMPTO END_~4
- REPLACE$ L$,1,L%,U
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~4
-
- INSTR L%,L$,1,~3
- TEST L% = 0
- IF YES JUMPTO END_~3
- REPLACE$ L$,1,L%,T
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~3
-
- INSTR L%,L$,1,~2
- TEST L% = 0
- IF YES JUMPTO END_~2
- REPLACE$ L$,1,L%,S
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~2
-
- INSTR L%,L$,1,~1
- TEST L% = 0
- IF YES JUMPTO END_~1
- REPLACE$ L$,1,L%,R
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~1
-
- INSTR L%,L$,1,~0
- TEST L% = 0
- IF YES JUMPTO END_~0
- REPLACE$ L$,1,L%,Q
- ADD L%,1
- REPLACE$ L$,1,L%,D$
- :END_~0
-
- INSTR L%,L$,1,`9
- TEST L% = 0
- IF YES JUMPTO END_`9
- REPLACE$ L$,1,L%,Z
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`9
-
- INSTR L%,L$,1,`8
- TEST L% = 0
- IF YES JUMPTO END_`8
- REPLACE$ L$,1,L%,Y
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`8
-
- INSTR L%,L$,1,`7
- TEST L% = 0
- IF YES JUMPTO END_`7
- REPLACE$ L$,1,L%,X
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`7
-
- INSTR L%,L$,1,`6
- TEST L% = 0
- IF YES JUMPTO END_`6
- REPLACE$ L$,1,L%,W
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`6
-
- INSTR L%,L$,1,`5
- TEST L% = 0
- IF YES JUMPTO END_`5
- REPLACE$ L$,1,L%,V
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`5
-
- INSTR L%,L$,1,`4
- TEST L% = 0
- IF YES JUMPTO END_`4
- REPLACE$ L$,1,L%,U
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`4
-
- INSTR L%,L$,1,`3
- TEST L% = 0
- IF YES JUMPTO END_`3
- REPLACE$ L$,1,L%,T
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`3
-
- INSTR L%,L$,1,`2
- TEST L% = 0
- IF YES JUMPTO END_`2
- REPLACE$ L$,1,L%,S
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`2
-
- INSTR L%,L$,1,`1
- TEST L% = 0
- IF YES JUMPTO END_`1
- REPLACE$ L$,1,L%,R
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`1
-
- INSTR L%,L$,1,`0
- TEST L% = 0
- IF YES JUMPTO END_`0
- REPLACE$ L$,1,L%,Q
- ADD L%,1
- REPLACE$ L$,1,L%,P$
- :END_`0
-
- :WRITE_RESULT
- USERWRITE 2,L$
- USERWRCR 2
- JUMPTO LOOP
- :EXITLOOP
-
- ( *** Close up files and compile (if possible)
- USERCLOSE 1
- USERCLOSE 2
- TEST M% > 0
- IF YES JUMPTO MENUDOES_PROBLEM
- COMPILE LOUD O$
- END
-
- :MENUDOES_PROBLEM
- COPYINTO X$,This procedure contains
- NUMTOSTRING M%,M$
- CONCAT X$,M$
- CONCAT X$, MENUDOES commands that I am unable to
- COPYINTO Y$,completely translate. Please edit them, and then compile.
- COPYINTO Z$,Sorry for the inconvenience...talk to Scott about this one.
- QUERY2
- END
-
- :ABORT
- @ OFF
- END
-
- :SANITY
- (
- ( PURPOSE: Notify the user of progress...slow though it may be...
- (
- ADD C%,1
- NUMTOSTRING C%,C$
- COPYINTO @1,Processing line #
- CONCAT @1,C$
- CONCAT @1,...
- SHOW@
- RETURN
-
-